import http from '@/utils/http'

export interface BasicInfoModel {
  email?: string;
  nickname?: string;
  gender?: number;
  mobile?: string;
  intro?: string;
  avatar?: string;
}

export interface EnterpriseCertificationModel {
  accountType: number;
  status: number;
  time: string;
  legalPerson: string;
  certificateType: string;
  authenticationNumber: string;
  enterpriseName: string;
  enterpriseCertificateType: string;
  organizationCode: string;
}

export type CertificationRecord = Array<{
  certificationType: number;
  certificationContent: string;
  status: number;
  time: string;
}>;

export interface UnitCertification {
  enterpriseInfo: EnterpriseCertificationModel;
  record: CertificationRecord;
}

/**
 * 更新用户信息
 */
export function updateRows(request: BasicInfoModel) {
  return http.put('/admin/index/updateUserInfo', request);
}
export function queryCertification() {
  return http.get<UnitCertification>('/admin/mock/api-user-certification');
}

export function userUploadApi(data: FormData) {
  return http.post('/admin/upload/images', data);
}
export interface UpdatePassWord {
  oldPassword: string;
  newPassword: string;
  rePassword: string;
}
/**
 * 更新用户密码
 */
export function updateUserPassWord(request: UpdatePassWord) {
  return http.put('/admin/index/updatePwd', request);
}